<%-- 
    Document   : archives_by_type_sidebar
    Created on : 2 Jun, 2012, 11:40:18 PM
    Author     : bharat
--%>

<link rel="stylesheet" type="text/css" href="./css/maincss.css">
<%@page contentType="text/html" pageEncoding="UTF-8"%>
<%@page import="java.sql.*" %>
<!DOCTYPE html>
<div class="sidebar">
    <%
        String type = request.getParameter("type");

        Connection con6 = null;
        PreparedStatement pstmt6 = null;
        ResultSet rs6 = null;

        try {
            Class.forName("oracle.jdbc.driver.OracleDriver");
            con6 = DriverManager.getConnection("jdbc:oracle:thin:@localhost:1521:xe", "aksh", "aksh");

            pstmt6 = con6.prepareStatement("select pid, subject from posts where type=?");
            pstmt6.setString(1, type);
            rs6 = pstmt6.executeQuery();
    %>

    <table style="background-color: #ddd ">
        <tr>
            <td style="background-color: #b4b4b4">Archives</td>
        </tr>

        <%
            while (rs6.next()) {
        %>

        <tr>
            <td><a href="display_post_by_type_when_clicked.jsp?pid1=<%=rs6.getString("pid")%>"><%=rs6.getString("subject")%></a></td>
        </tr>
        <% }%>
    </table>

    <%
        } catch (Exception e) {
            response.sendError(502, e.getMessage());
            e.printStackTrace();
        }

    %>

</div>